<html>
    <head>
        <title>Test</title>
        <style>

pre {
  behavior:selectable;
}

        </style>
        <script type="module">

import * as sys from "@sys";

var pre = document.querySelector("pre");

async function postit() {
  try {

    let file = await sys.fs.open(URL.toPath(__DIR__ + "test-upload.htm"));

    let dataToSend = {"file1": file, "comment1": "this is just a test" };

    var resp = await fetch("https://sciter.com/test/test-file-receiver.php", {
      method: "POST",
      body: dataToSend
    });

    file.close();

    pre.innerText = await resp.text();
  } catch (e) {
    console.log(e);
  }
}

postit();

        </script>
    </head>
    <body>
      <p>Data received by <code>await fetch(url)</code>:</p>
      <pre />    
    </body>
</html>